//
// Created by alexa on 5/13/2024.
//

#ifndef ARTILLERYSYSTEM_CREWSSERVICE_H
#define ARTILLERYSYSTEM_CREWSSERVICE_H


#include "../../repositories/crew-repository/CrewRepository.h"
#include "../soldiers-service/SoldiersService.h"

class UnitsService;

class CrewsService {
private:
    CrewRepository repository;

    SoldiersService *soldiersService;

    UnitsService *unitsService;
public:

    void setUnitsService(UnitsService *unitsService);

    explicit CrewsService(SoldiersService *soldiersService);

    MaintenanceCrew *getById(string id);

    vector<MaintenanceCrew *> getAll();

    MaintenanceCrew *createOne();

    void addSoldier(string crewId, string soldierId);

    void removeSoldier(string crewId, string soldierId);

    vector<Soldier *> getSoldiersInCrew(string crewId);

    void deleteOne(string id);

    MaintenanceCrew *findBySoldierId(string soldierId);

    vector<Specialization>
    getMissingSpecializationsInCrew(string crewId, vector<Specialization> requiredSpecializations);

    void saveCrew(MaintenanceCrew *crew);

    friend class MainService;
};

#include "../combat-units-service/UnitsService.h"

#endif //ARTILLERYSYSTEM_CREWSSERVICE_H
